from langchain_community.vectorstores import Chroma
from langchain_core.tools import create_retriever_tool
from yunjian.price.Embed_model import BGE_Embed

# 加载向量库
embedding = BGE_Embed()
vectorstore = Chroma(
    embedding_function=embedding,
    persist_directory=''
)

# 创建检索器
retriever = vectorstore.as_retriever(search_kwargs={'k': 3})

# 创建retriever工具
retriever_tool = create_retriever_tool(
    retriever,
    "yingong",
    "业务咨询和价格查询"
)

# 工具列表
tools = [retriever_tool]

res=retriever.invoke("云剪多少钱？")
print(res)